<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>监理服务系统</title>
    <!--公用样式-->
    <link rel="stylesheet" type="text/css" href="${re.contextPath}/plugin/common/css/comment.css" />
    <!--页面样式-->
    <link rel="stylesheet" type="text/css" href="${re.contextPath}/plugin/common/css/style.css"/>
    <link rel="stylesheet" href="${re.contextPath}/plugin/common/css/extended.css">
    <link rel="stylesheet" type="text/css" href="${re.contextPath}/plugin/layui/css/layui.css"/>
    <#--<script type="text/javascript" charset="utf-8" src="${re.contextPath}/plugin/layui/layui.js"></script>-->
    <script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
    <script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js"></script>
    <script type="text/javascript" src="${re.contextPath}/plugin/common/js/comment.js"></script>
    <script type="text/javascript" src="${re.contextPath}/pageoffice.js" id="po_js_main"></script>
</head>
<script type="text/html" id="envdetail">
    <span class="dodgerblue cursor" spid="{{d.spId}}" onclick="seeEnvDetail(this)">查看详情</span>
</script>
<style type="text/css">

    .Right {
        width: 100%;
        overflow-y: scroll;
    }

    .layui-col-md3 {
        width: 26%;
    }
    .layui-col-md9 {
        width: 52%;
    }
    .layui-tab {
        margin: 50px 0;
        text-align: left!important;
        border-radius: 10px;
        margin-left: 30px;
        width: 93%;
        padding: 1% 2%;
        margin: 30px auto;
        border-radius: 10px 10px 0px 0px;
        margin: 20px 1px;
    }
    .layui-tab-content {
        padding: 0px;
    }

    .layui-tab-title {
        position: relative;
        left: 0;
        height: 40px;
        white-space: nowrap;
        font-size: 0;
        border-bottom-width: 1px;
        border-bottom-style: solid;
        transition: all .2s;
        -webkit-transition: all .2s;
        background-color: white;
        border-radius: 10px 10px 0px 0px;
    }
    .ta_right {
        text-align: right;
    }

    .password_explain {
        font-size: 14px;
        line-height: 123%;
        color: #aaa;
        width: 40%;
    }

    .layui-form-item .layui-inline{
        margin-right: 0px;
    }
    layui-form-label{
        padding: 9px 0px;
    }
    .layui-table-tool-self{
        display: none;
    }
    .layui-table-edit {
        height:100%
    }
    .layui-table-cell{
        height: 100%;
    }
    .layui-laypage-limits{
        width: 120px;
    }
    /* 设置下拉框的高度与表格单元相同 */
    /*td .layui-form-select {*/
    /*    margin-top: -10px;*/
    /*    margin-left: -15px;*/
    /*    margin-right: -15px;*/
    /*}*/
    .layui-tab-brief > .layui-tab-title .layui-this {
        color: #5775EF;
    }

    .layui-tab-brief > .layui-tab-more li.layui-this:after, .layui-tab-brief > .layui-tab-title .layui-this:after {
        border-bottom: 2px solid #5775EF;
    }

    .layui-form-select dl dd.layui-this {
        background-color: #5775EF;
    }

    img[src=""], img:not([src]) {
        opacity: 0;
    }
</style>

<body>
<!--容器-->
<div class="container index clearfix">
    <!--右侧内容-->
    <div class="Right fr" style="overflow-y: hidden;">

        <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief" style="margin-top: 12px;">
            <ul class="layui-tab-title" style="padding-top: 20px;padding-left: 20px;">
                <li class="layui-this">个人信息</li>
                <li <#if (shenhe == '1')>style="display: none"</#if>>个人设置</li>
                <li <#if (shenhe == '1')>style="display: none"</#if>>修改密码</li>
                <li <#if (shenhe == '1')>style="display: none"</#if>>项目评分</li>
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <form action="" class="layui-form" enctype="multipart/form-data">
                        <!--个人信息-->
                        <div class="myDatatTop whitebg" >

                            <div class="myDataCentere" style="margin-top: 0px;margin-left: 0px;  margin-bottom: 20px; width: 96%;">
                                <ul class="clearfix" style="width: 85%;padding-bottom: 20px;">
                                    <li class="clearfix">
                                        <label class="fl">角色</label>
                                        <input type="text" class="fl" value="${user.gxname}" disabled>
                                    </li>
                                    <li class="clearfix">
                                        <label class="fl">业务类型</label>
                                        <input type="text" class="fl" value="${user.ywname}" disabled>
                                    </li>
                                    <li class="clearfix">
                                        <label class="fl">身份</label>
                                        <input type="text" class="fl" value="${user.ptname}" disabled>
                                    </li>
                                </ul>
                            </div>
                        </div>
                        <div class="myData whitebg" style="margin-left: 0px;width: 96%;">
                            <span class="audit-status audit-status1" style="color: green" <#if (user.auditStatus != '1')>hidden</#if>>审核通过</span>
                            <span class="audit-status audit-status3" style="color: darkorange" <#if (user.auditStatus != '3')>hidden</#if>>审核中</span>
                            <span class="audit-status audit-status2 red" <#if (user.auditStatus != '2')>hidden</#if>>信息审核未通过，驳回原因：${user.auditFailReason}</span>
                            <div class="myDataCentere myDataCentereTwo mt30"  >
                                <ul class="clearfix">
                                    <li class="clearfix">
                                        <label class="fl">公司logo</label>
                                        <label>
                                            <div class="fl">
                                                <#if "${file}" !="${null}" && (file.xgtx) != "${null}">
                                                    <img class="ml50" src="${file.xgtx}" alt="" id="img4">
                                                <#else>
                                                    <img class="layui-upload-img ml50" id="img4"
                                                         src="${re.contextPath}/plugin/common/images/zzlogo.jpg">
                                                </#if>
                                                <button type="button" lay-data="{type: '208',imgid:'img4'}"
                                                        class="gr_upload whitebutton ft12 blue ml50">修改LOGO
                                                </button>
                                            </div>
                                        </label>
                                    </li>
                                    <li class="clearfix">
                                        <label class="fl"><span class="red">*</span>用户名</label>
                                        <input type="text"   name="username" id="username" value="${user.username}"   disabled>
                                        <#-- <input type="text" value="username"  lay-verify="username"  placeholder="请输入用户名">-->
                                    </li>
                                    <li class="clearfix">
                                        <label class="fl"><span class="red">*</span>单位名称</label>
                                        <input type="text" name="companyName" id="companyName" lay-maxlength="40" lay-verify="required|maxlength" class="fl" value="${user.companyName}">
                                    </li>
                                    <li class="clearfix">
                                        <label class="fl"><span class="red">*</span>组织机构代码</label>
                                        <input type="text" name="jgcode" id="jgcode" class="fl" lay-maxlength="40" lay-verify="required|maxlength" value="${user.jgcode}">
                                    </li>
                                    <li class="clearfix">
                                        <label class="fl"><span class="red">*</span>联系人</label>
                                        <input type="text" name="linkPerson" id="linkPerson" lay-maxlength="40" lay-verify="required|maxlength" class="fl" value="${user.linkPerson}">
                                    </li>
                                    <li class="clearfix" >
                                        <label class="fl">单位性质</label>
                                        <div class="layui-col-md9">
                                            <select id=companyType" lay-verify="companyType"
                                                    name="companyType" lay-verify="companyType">
                                                <#list dwlist as vo>
                                                    <#if "${user.companyType}" =="${vo.badtCode}">
                                                        <option value="${vo.badtCode}" selected="true">${vo.badtName}</option>
                                                    <#else>
                                                        <option value="${vo.badtCode}">${vo.badtName}</option>
                                                    </#if>
                                                </#list>
                                            </select>
                                        </div>
                                    </li>

                                    <li class="clearfix">
                                        <label class="fl"><span class="red">*</span>联系方式</label>
                                        <input type="text" name="phoneNumber" lay-verify="required|phoneNumber" id="phoneNumber" class="fl" value="${user.phoneNumber}">
                                    </li>
                                    <li class="clearfix">
                                        <label class="fl"><span class="red">*</span> 注册地址</label>
                                        <div class="layui-col-md3"  style="display: inline;">
                                            <select name="province" id="province"  lay-verify="province"   style="width: 25% !important;"  lay-filter="province"   >
                                                <#--   <option value="">请选择</option>-->
                                                <#list provincelist as vo>
                                                    <#if "${user.province}" =="${vo.code}">
                                                        <option value="${vo.code}" selected="true">${vo.name}</option>
                                                    <#else>
                                                        <option value="${vo.code}" >${vo.name}</option>
                                                    </#if>
                                                </#list>
                                            </select>
                                        </div>
                                        <div class="layui-col-md3" style="display: inline;">
                                            <select name="city" id="city" class="ml10" lay-verify="city" value="001"  style="width:25% !important;" lay-filter="city"   >
                                                <#list citylist as vo>
                                                    <#if "${user.city}" =="${vo.code}">
                                                        <option value="${vo.code}" selected="true">${vo.name}</option>
                                                    <#else>
                                                        <option value="${vo.code}" >${vo.name}</option>
                                                    </#if>
                                                </#list>
                                            </select>
                                        </div>
                                    </li>
                                    <li class="clearfix">
                                        <label class="fl">详细地址</label>
                                        <input type="text" name="address" lay-maxlength="40" lay-verify="maxlength" id="address" class="fl" value="${user.address}">
                                    </li>
                                    <li class="clearfix">
                                        <label class="fl"><span class="red">*</span> 邮箱</label>
                                        <input type="text" name="email" lay-verify="email|required" id="email" class="fl" value="${user.email}">
                                        <input type="hidden" name="id" id="id" value="${user.id}"    >
                                    </li>
                                </ul>
                            </div>
                        </div>
                        <div class=" whitebg">
                            <div class="addIndexGFZZ"  style="width: 91%;margin: auto;padding: 30px 0 0;">
                                <ul class="clearfix">
                                    <li class="clearfix">
                                        <label class="fl">公司人员数量</label>
                                        <input type="number" class="fl" name="personNumber" min="0" value="${user.personNumber}" lay-maxlength="40" lay-verify="maxlength">
                                    </li>
                                    <li class="clearfix">
                                        <label class="fl">本科及以上人员数</label>
                                        <input type="number" class="fl" name="bachelorDegreeAboveNumber" min="0" value="${user.bachelorDegreeAboveNumber}" lay-maxlength="40" lay-verify="maxlength">
                                    </li>
                                    <li class="clearfix">
                                        <label class="fl">项目经理及以上人数</label>
                                        <input type="number" class="fl" name="projectManagerAboveNumber" min="0" value="${user.projectManagerAboveNumber}" lay-maxlength="40" lay-verify="maxlength">
                                    </li>
                                    <li class="clearfix">
                                        <label class="fl" style="width:17%"><span class="red">*</span>营业执照</label>
                                        <label>
                                            <div class="fl clearfix" style="margin-right: 20px;">
                                                <div id="bus_div" class="upCard fl ml20 mt10">
                                                    <img src="${re.contextPath}/plugin/common/images/57@2x.png" alt="">
                                                    <button type="button" lay-data="{type: '201',imgid:'img'}"
                                                            class="gr_upload whitebutton">上传营业执照
                                                    </button>
                                                </div>
                                            </div>
                                        </label>
                                        <div class="layui-upload-list">
                                            <#if "${file}" !="${null}" && (file.yyzz) != "${null}">
                                                <img class="layui-upload-img bus_img cursor" id="img" height="100" width="150"
                                                     src="${file.yyzz}" onclick="showImg(this)">
                                            <#else>
                                                <img class="layui-upload-img bus_img cursor" id="img" height="100" width="150"
                                                     style="display:none" onclick="showImg(this)">
                                            </#if>
                                            <p id="demoText"></p>
                                        </div>

                                    </li>
                                    <li class="clearfix">
                                        <label class="fl">备注</label>
                                        <input type="text" class="fl" name="remark" value="${user.remark}" lay-maxlength="40" lay-verify="maxlength">
                                    </li>
                                </ul>
                            </div>
                            <div class="downModule whitebg">
                                <div>
                                    <span class="red">* </span> 上传承诺函 <span
                                            class="red">（请下载模板进行填写，填写完毕加盖公章后。上传PDF扫描件）</span>
                                </div>
                                <div class="downModuleText clearfix mt30">
                                    <div class="clearfix fl">
                                        <img src="${re.contextPath}/plugin/common/images/59@2x.png" alt="" class="fl">
                                        <span class="fl ml10 mt10">承诺函模板</span>
                                    </div>
                                    <span class=" fl ml50 blue cursor mt10" onclick="down_cnh()">下载模板</span>
                                </div>
                                <ul class="mt30">
                                    <li>
                                        <div class="clearfix">
                                            <div class="downModuleTip clearfix fl" <#if (shenhe == '1')>style="display: none"</#if>>
                                                <#if "${cnh.id}" !="${null}" && "${cnh.lcStatus}" =="2">
                                                    <img id="cnh-status-img" class="fl" style="margin:10px 0px" src="${re.contextPath}/plugin/common/images/15@2x.png" alt="">
                                                <#elseif "${cnh.id}" !="${null}" && "${cnh.lcStatus}" !="2">
                                                    <img id="cnh-status-img" class="fl" style="margin:10px 0px" src="${re.contextPath}/plugin/common/images/16@2x.png" alt="">
                                                <#else>
                                                    <img id="cnh-status-img" class="fl" style="margin:10px 0px" src="${re.contextPath}/plugin/common/images/17@2x.png" alt="">
                                                </#if>
                                                <span class="fl ml10 mt10">上传承诺函（必填）</span>
                                            </div>
                                            <div class="downModuleBtn clearfix fr" <#if (shenhe == '1')>style="display: none"</#if>>
                                                <img id="upload-cnh-img"
                                                     src="${re.contextPath}/plugin/common/images/18@2x.png"
                                                     <#if (cnh == null || cnh == '') || (cnh !=null  && (cnh.lcStatus) != '2')>class="fl cursor"
                                                     onclick="uploadCnh(this)"</#if>
                                                        <#if cnh !=null  && (cnh.lcStatus) == '2'>class="fl" style="cursor: not-allowed"</#if> >
                                                <button id="upload-cnh-btn" type="button" style="display: none"
                                                        lay-data="{type:'552',id:'<#if cnh !=null  && (cnh.id) != null>
                                                        ${cnh.id}</#if>',filestatus:'<#if cnh !=null  && (cnh.id) != null>${cnh.lcStatus}</#if>'}"
                                                        class="img-upload whitebutton ft12 blue">点击上传
                                                </button>
                                                <img id="del-cnh-img"
                                                     src="${re.contextPath}/plugin/common/images/19@2x.png"
                                                     <#if (cnh == null || cnh == '') || (cnh !=null  && (cnh.lcStatus) != '2')>class="fl cursor"
                                                     cnhfileid="${cnh.id}" onclick="delCnh(this)"</#if>
                                                        <#if cnh !=null  && (cnh.lcStatus) == '2'>class="fl" style="cursor: not-allowed"</#if>
                                                     alt="">
                                                <input id="cnh-finish-input" type="button"
                                                       <#if cnh !=null  && (cnh.id) != null>fileid="${cnh.id}"</#if>
                                                       class="layui-btn layui-btn-normal fl bluebg white ml20 mt10"
                                                       value="完成"
                                                        <#if cnh !=null  && (cnh.lcStatus) == '2'>style="cursor: not-allowed"</#if>
                                                        <#if (cnh.lcStatus) != '2'>onclick="finishcnh(this)"</#if> >
                                            </div>
                                        </div>
                                        <ul id="cnh-file-ul"
                                            <#if cnh ==null  || (cnh.id) == "${null}">style="display: none"
                                            cnhid="${cnh.id}"</#if>
                                                <#if cnh !=null  && (cnh.id) != "${null}"> cnhid="${cnh.id}"</#if>>
                                            <li class="clearfix">
                                                <input type="checkbox" id="cnh-checkbox" class="fl ml10" lay-ignore>
                                                <span class="fl ml10" id="cnh-span" filesuffix="<#if cnh !=null  && (cnh.fileType) != "${null}">${cnh.fileType?substring(1)}</#if>"
                                                      fileurl="<#if cnh !=null  && (cnh.url) != "${null}">${cnh.url}</#if>"
                                                      onclick="openCnh(this)"
                                                >承诺函</span>
                                            </li>
                                        </ul>
                                    </li>
                                </ul>
                            </div>
                            <div class="myDataBtn center">
                                <button class="bluebg white bor0" lay-filter="submitUser" lay-submit type="button">保存
                                </button>
                            </div>
                            <div class="pl50 pr50">
                                <div class="bolf mt20 ft18">公司资质证明文件</div>
                                <table id="zztable" class="mt20" lay-filter="zztable"></table>
                            </div>
                            <div class="gary center">
                                <#if (shenhe != '1')>
                                    <img src="${re.contextPath}/plugin/common/images/add.png"
                                         onclick="addOneEmptyLine('zztable')" alt="" class="cursor">
                                    <span>添加资质证明文件</span>
                                </#if>
                                <input type="button" class="layui-btn layui-btn-normal fr mr50" ind="0" value="保存" onclick="saveCertificate(this)">
                            </div>
                            <div class="pl50 pr50">
                                <div class="bolf mt20 ft18">公司业绩列表和证明文件</div>
                                <table id="yjtable" class="mt20" lay-filter="yjtable"></table>
                            </div>
                            <div class="gary center">
                                <#if (shenhe != '1')>
                                    <img src="${re.contextPath}/plugin/common/images/add.png"
                                         onclick="addOneEmptyLine('yjtable')" alt="" class="cursor">
                                    <span>添加公司业绩列表和证明文件</span>
                                </#if>
                                <input type="button" class="layui-btn layui-btn-normal fr mr50" ind="0" value="保存" onclick="saveYj(this)">
                            </div>
                            <div class="protips red">友情提示：为了提高应接项目成功率，请尽快完成信息及资料</div>
                        </div>


                    </form>
                    <#if (shenhe == '1')>
                        <div class="layui-row">
                            <div class="layui-col-md1 layui-col-md-offset5">
                                <input class="layui-btn layui-btn-normal ashow" type="button" value="审核通过" onclick="pass()">
                            </div>
                            <div class="layui-col-md1">
                                <input class="layui-btn layui-btn-danger ashow" type="button" value="审核拒绝" onclick="noPass()">
                            </div>
                        </div>
                    </#if>
                </div>
                <div class="layui-tab-item">
                    <div class="myDatatTop whitebg" style=" padding: 20px 5%;">
                        <form action="" class="layui-form" enctype="multipart/form-data">
                            <div class="myDataCentere" style="margin-top: 0px;margin-left: 0px;  margin-bottom: 20px; width: 96%;">
                                <div class="set mt50">
                                    <div class="clearfix">
                                        <label class="fl mt10">项目显示标签个数</label>
                                        <input type="text" name="numTag" id="numTag" lay-verify="numTag" type="password"
                                               class="fl ml10" value="${user.numTag}"
                                               onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"
                                               onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'0')}else{this.value=this.value.replace(/\D/g,'')}">
                                        <input type="hidden" name="id" value="${user.id}">
                                        <input type="hidden" name="username" id="username" value="${user.username}">
                                        <span class="fl mt10 ml10">个</span>
                                    </div>
                                    <ul class="clearfix" style="width: 100%;">
                                        <li class="clearfix" style="width: 45%;">
                                            <div class="fl">
                                                <div>电子签章</div>
                                                <div class="dzbor" style="position: relative;float: left;">
                                                    <#if "${file}" !="${null}" && (file.dzqz) != "${null}">
                                                        <img src="${re.contextPath}/plugin/common/images/close.png"
                                                             style="width: 30px;height: 30px;position: absolute;right: 0;top: 0;cursor:pointer;"
                                                             id="delimg1"
                                                             data-type="202" data-id="img1"
                                                             onclick="deleteImg('${file.dzqz}', 1, this)"/>
                                                        <img class="layui-upload-img bor0" id="img1"
                                                             src="${file.dzqz}">
                                                    <#else>
                                                        <img src="${re.contextPath}/plugin/common/images/close.png"
                                                             style="display: none;width: 30px;height: 30px;position: absolute;right: 0;top: 0;cursor:pointer;"
                                                             id="delimg1"
                                                             data-type="202" data-id="img1"
                                                             onclick="deleteImg('', 2, this)"/>
                                                        <img class="layui-upload-img" id="img1" style="display:none">
                                                    </#if>
                                                </div>
                                            </div>
                                            <div class="fr mt50">
                                                <div class="pink">建议：100KB</div>
                                                <div class="pink">要求：白背景</div>
                                                <button type="button" lay-data="{type: '202',imgid:'img1'}"
                                                        class="blue mt60 gr_upload">点击上传
                                                </button>
                                            </div>
                                        </li>
                                        <li class="clearfix" style="width: 45%;">
                                            <div class="fl">
                                                <div>电子签名</div>
                                                <div class="dzbor"
                                                     style="height: 150px!important;position: relative;float: left;">
                                                    <#if "${file}" !="${null}" && (file.dzqm) != "${null}">
                                                        <img src="${re.contextPath}/plugin/common/images/close.png"
                                                             style="width: 30px;height: 30px;position: absolute;right: 0;top: 0;cursor:pointer;"
                                                             id="delimg2"
                                                             data-type="203" data-id="img2"
                                                             onclick="deleteImg('${file.dzqm}', 1, this)"/>
                                                        <img class="layui-upload-img bor0 " id="img2"
                                                             src="${file.dzqm}"
                                                             style="height: 150px">
                                                    <#else>
                                                        <img src="${re.contextPath}/plugin/common/images/close.png"
                                                             style="display: none;width: 30px;height: 30px;position: absolute;right: 0;top: 0;cursor:pointer;"
                                                             id="delimg2"
                                                             data-type="203" data-id="img2"
                                                             onclick="deleteImg('', 2, this)"/>
                                                        <img class="layui-upload-img" id="img2"
                                                             style="display:none;height: 150px">
                                                    </#if>
                                                </div>
                                            </div>
                                            <div class="fr mt50">
                                                <div class="pink">建议：100KB   </div>
                                                <div class="pink">要求：白背景</div>
                                                <div class="pink">长宽比例：3:2</div>
                                                <button type="button" lay-data="{type: '203',imgid:'img2'}"
                                                        class="blue mt80 gr_upload">点击上传
                                                </button>
                                            </div>
                                        </li>
                                    </ul>
                                </div>
                                <div class="myDataBtn center">
                                    <button class="bluebg white bor0" lay-filter="submitNum" lay-submit type="button">
                                        保存
                                    </button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
                <div class="layui-tab-item">
                    <div class="myDatatTop whitebg">
                        <form class="layui-form" method="post">
                            <div class="modify mt50">
                                <ul>
                                    <li class="clearfix">
                                        <label class="fl" style="text-align: right">用户名</label>
                                        <span class="ml20">${user.username}</span>
                                        <input type="hidden" name="id" value="${user.id}">
                                    </li>
                                    <li class="clearfix" style="margin-top:30px">
                                        <label class="fl ta_right">原始密码</label>
                                        <input name="pass" id="pass" type="password" class="fl ml20" lay-verify="pass"
                                               style="width: 30%" placeholder="请输入原始密码">
                                    </li>
                                    <li class="clearfix" style="margin-top:30px">
                                        <label class="fl ta_right">新密码</label>
                                        <input name="newPwd1" id="newPwd1" type="password" lay-verify="newPwd1"
                                               class="fl ml20" style="width: 30%" placeholder="请输入新密码">
                                        <span class="fl ml10 password_explain">密码最少为8位,且至少包含大写字母、小写字母、数字、特殊字符(~!@#$%^&*)中的三种</span>
                                    </li>
                                    <li class="clearfix" style="margin-top:30px">
                                        <label class="fl ta_right">确认密码</label>
                                        <input name="newPwd" id="newPwd" type="password" class="fl ml20"
                                               lay-verify="newPwd" style="width: 30%" placeholder="请再次输入新密码">
                                    </li>
                                </ul>
                                <div class="myDataBtn center">
                                    <button class="bluebg white bor0" lay-filter="submitPwd" lay-submit type="button">
                                        保存
                                    </button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
                <div class="layui-tab-item">
                    <div class="myDatatTop whitebg" style="padding:50px;">
                        <table id="envtable" lay-filter="envtable"></table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!--公用样式JS-->
<script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js"></script>
<script type="text/javascript" src="${re.contextPath}/plugin/tools/cardUtils.js"></script>
<script type="text/html" id="barDemo">
    <img src="${re.contextPath}/plugin/common/images/del.png" tableind="{{d.LAY_TABLE_INDEX}}" sucid="{{d.sucId}}"
         class="cursor" alt="" class="delete" lay-event="del" tableid="zztable" delurl="/sys/personCenter/delCert" <#if (shenhe != '1')>onclick="delZz(this)"</#if>>
</script>
<script type="text/html" id="barDemoYj">
    <img src="${re.contextPath}/plugin/common/images/del.png" tableind="{{d.LAY_TABLE_INDEX}}" supid="{{d.supId}}"
         class="cursor" alt="" class="delete" lay-event="del" tableid="yjtable" delurl="/sys/personCenter/delYj" <#if (shenhe != '1')>onclick="del(this)"</#if>>
</script>
<script type="text/html" id="tabelArea">
    <select name="supArea" class="sel_xlk" lay-filter="hyselect" lay-verify="required" value="{{d.supArea}}" data-value="{{d.supArea}}" data-tableind="{{d.LAY_TABLE_INDEX}}">
        <#list areaList as area>
            <#if area.badtCode==d.supArea>
                <option value="${area.badtCode}" selected>${area.badtName}</option>
            <#else>
                <option value="${area.badtCode}">${area.badtName}</option>
            </#if>
        </#list>
    </select>
</script>
<script>
    //注意：选项卡 依赖 element 模块，否则无法进行功能性操作
    layui.use('element', function () {
        var element = layui.element;
        //…
    })
    var layer,form = layui.form, table, upload,laydate;
    var cnhFileId = "${cnh.id}";
    var cnhFileStatus = "${cnh.lcStatus}";
    var uploadFilePara = {
        type: '',
        id: cnhFileId
    };
    var zzDeledTrIds = [],yjDeledTrIds = [];
    var shenhe = '${shenhe}';
    var shenheinguserid = '${shenheinguserid}';
    $(function () {
        if(shenhe){
            $('input:not(.gr_upload):not(.ashow)[type="button"]').hide();
            $('button:not(.gr_upload)').hide();
            $('input:not(.ashow)').attr('disabled','disabled');
            $('select').attr('disabled','disabled');
            $('textarea').attr('disabled','disabled');
            setTimeout(function(){
                $('input:not(.gr_upload):not(.ashow)[type="button"]').hide();
                $('button:not(.gr_upload)').hide();
                $('input:not(.ashow)').attr('disabled','disabled');
                $('select').attr('disabled','disabled');
                $('.upCard').css('cursor','default');
                $('button').css('cursor','default');
                $('a').css('cursor','default');
            },2000);
        }
        layui.use(['form', 'layer', 'table'], function () {
            table = layui.table;
            upload = layui.upload;
            laydate = layui.laydate;
            form.verify({
                maxlength: function (v,item) {
                    var maxlength = item.getAttribute('lay-maxlength');
                    if(v.trim()!=''){
                        if(v.trim().length>maxlength){
                            return "输入长度不能大于"+maxlength+"个字符！";
                        }
                    }
                },
                jgcode: function (v) {
                    if (v.trim() == '') {
                        return "组织机构不能为空";
                    }
                },
                linkPerson: function (v) {
                    if (v.trim() == '') {
                        return '联系人不能为空';
                    }
                },
                address: function (v) {
                    if (v.trim() == '') {
                        return '详细地址不能为空';
                    }
                },
                companyType: function (v) {
                    if (v.trim() == '') {
                        return '单位性质不能为空';
                    }
                },
                email: function (v) {
                    if (v.trim() != '') {
                        var reg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
                        var flag = reg.test(v.trim());
                        if (!flag) {
                            return '邮箱格式输入有误';
                        }
                    }
                },
                province: function (v) {
                    if (v.trim() == '') {
                        return '省不能为空';
                    }
                },
                city: function (v) {
                    if (v.trim() == '') {
                        return '市不能为空';
                    }
                },
                phoneNumber: function (v) {
                    if (v.trim() == '') {
                        return '联系方式不能为空';
                    } else {
                        if (!v.trim().isMobile() && !v.trim().isTel()) {
                            return '请输入正确的手机号码或电话号码\n\n例如:13916752109或0531-3614072';
                        }
                    }
                },
                pass: function (v) {
                    if (v.trim() == '') {
                        return '原密码不能为空';

                    }
                },
                newPwd1: function (v) {
                    if (v.trim() == '') {
                        return '新密码不能为空';
                    }
                    var result = '';
                    $.ajax({
                        url: '/sys/register/checkpwd',
                        data: {pwd: v.trim()},
                        type: 'GET',
                        cache: false,
                        async: false,
                        success: function (res) {
                            if (!res.flag) {
                                result = '密码格式输入有误';
                            }
                        }
                    })
                    return result;
                },
                newPwd: function (v) {
                    if (v.trim() == '') {
                        return '确认密码不能为空';
                    }
                    var newPwd1 = $("#newPwd1").val().trim();
                    if (v.trim() != newPwd1) {
                        return '两次密码不一致';
                    }
                },
                numTag: function (v) {
                    if (v.trim() == '') {
                        return "标签个数不能为空";
                    }
                }
            });
            //监听提交
            form.on('submit(submitUser)', function (data) {
                //判断营业执照
                if(!checkPhoto('bus','营业执照')){
                    return ;
                };
                //判断承诺函是否上传了：
                if($("#cnh-file-ul").css("display") == "none"){
                    layer.msg("请上传承诺函",{icon:2});
                    return ;
                }
                layerAjax('/sys/personCenter/updateUsers', data.field, '', function (d) {
                    if (d.flag == true) {
                        layer.msg("已提交，请耐心等待管理员审核", {icon: 1});
                        flushAuditStatus();
                    } else {
                        layer.msg(d.msg, {icon: 2});
                    }
                });
                return false;
            });

            form.on('submit(submitNum)', function (data) {
                layerAjax('/sys/personCenter/updateNum', data.field, '', function (d) {
                    if (d.flag == true) {
                        layer.msg(d.msg, {icon: 1});
                    } else {
                        layer.msg(d.msg, {icon: 2});
                    }
                });
                return false;
            });

            form.on('submit(submitPwd)', function (data) {
                layerAjax('/sys/personCenter/rePass', data.field, '', function (d) {
                    if (d.flag == true) {
                        layer.msg(d.msg, {icon: 1});
                        $("#pass").val('');
                        $("#newPwd1").val('');
                        $("#newPwd").val('');
                    } else {
                        layer.msg(d.msg, {icon: 2});
                    }
                });
                return false;
            });
            form.render();

            //评分表格：
            table.render({
                elem: '#envtable'
                // ,height: 'full-200'
                , url: '/supervisor/projectManager/tagList' //数据接口
                , page: true //开启分页
                , height: 'full-200'
                , cols: [[ //表头
                    {field: 'spId', hide: true}
                    , {field: 'speTarget', hide: true}
                    , {
                        field: '', title: '序号', align: 'center', width: '11%', templet: function (res) {
                            return res.LAY_INDEX;
                        }
                    }
                    , {field: 'spName', align: 'center', width: '30%', title: '项目名称'}
                    , {field: 'score', align: 'center', width: '30%', title: '项目总平均分'}
                    , {field: 'action', align: 'center', width: '20%', title: '操作', templet: '#envdetail'}
                ]],
                parseData: function (res) {
                    return {
                        "code": res.code,
                        "msg": res.msg,
                        "count": res.count,
                        "data": res.data
                    }
                }
            });

            table.render({
                elem: '#zztable',
                data: [],
                // url: '/workEx/projectList',
                // where: {
                //     suweId: $("#work_history_suweid_0").val()
                // },
                page: false,
                limit: Number.MAX_VALUE,
                cols: [[
                    {field: 'sucId', hide: true},
                    {field: 'tableInd', hide: true},
                    {field: 'getDate', title: '获得时间', align: 'center',event: 'editGetDate',data_field:'getDate'},
                    {field: 'certificateName', title: '资质名称', align: 'center'<#if (shenhe != '1')>,edit: 'text'</#if>},
                    {field: 'issuingOrg', title: '发证机关', align: 'center'<#if (shenhe != '1')>,edit: 'text'</#if>},
                    {field: 'valiDate', title: '有效期', align: 'center',event: 'editValiDate',data_field: 'valiDate'},
                    { templet: setZzImg, title: '上传图片', align: 'center', width: '12%' },
                    {field: 'his_action', title: '操作', align: 'center', toolbar: '#barDemo'}
                ]],
                text: {
                    none: '点击下方添加按钮添加资质证明' //默认：无数据。注：该属性为 layui 2.2.5 开始新增
                },
                done: function (res, currentCount) {
                    var zzImgUploadSpans = $(".zz-img-uplod-span");
                    if(zzImgUploadSpans && zzImgUploadSpans.length > 0){
                            setZzImgUploader(table,zzImgUploadSpans,0);
                    }
                }
            })

            table.on('tool(zztable)',function(obj){
                if(obj.event == 'editGetDate'){
                    var field = $(this).data('field');
                    var tval = '';
                    if(obj.data.getDate){
                        tval = obj.data.getDate;
                    }
                    laydate.render({
                        elem: this.firstChild,
                        show: true,
                        closeStop: this,
                        done: function (value, res) {
                            //获取当前行:从0开始的下标
                            var thisRow = (obj.tr[0].rowIndex);
                            table.cache['zztable'][thisRow][field] = value;
                            obj.update(table.cache['zztable'][thisRow]);
                        }
                    });
                }
                if(obj.event == 'editValiDate'){
                    var field = $(this).data('field');
                    laydate.render({
                        elem: this.firstChild,
                        show: true,
                        closeStop: this,
                        done: function (value, res) {
                            //获取当前行:从0开始的下标
                            var thisRow = (obj.tr[0].rowIndex);
                            table.cache['zztable'][thisRow][field] = value;
                            obj.update(table.cache['zztable'][thisRow]);
                        }
                    });
                }
            })

            table.on('edit(zztable)',function(obj){
                //获取该单元格原来的值,oldtext就是原来的值
                var selector = obj.tr.find('[data-field=' + obj.field + ']');
                var oldtext = $(selector).text();
                //ooo代表需要校验的列field
                if (obj.field == 'certificateName' || obj.field == 'issuingOrg') {
                    if(obj.value && obj.value.length > 30){
                        layer.msg('长度不得超过30',{icon:2});
                        obj.tr.find('td[data-field='+obj.field+'] input').val(oldtext);
                        obj.update({ ooo: oldtext });
                    }
                }
            })

            uploadListIns = upload.render({
                elem: '.img-upload',
                url: '/sys/personCenter/uploadFile',
                accept: 'file',
                ext: 'jpg|png|gif|bmp|jpeg|pdf',
                data: uploadFilePara,
                multiple: false,
                auto: true,
                before: function (obj) {
                    var files = this.files = obj.pushFile();
                    uploadFilePara.type = "552";
                    if (this.id) {
                        uploadFilePara.id = cnhFileId;
                    }
                },
                done: function (res, index, upload) {
                    if (res.flag) {
                        layer.msg("上传成功", {icon: 1});
                        $("#cnh-file-ul").show();
                        $('#cnh-file-ul').attr('cnhid',res.msg);
                        $("#del-cnh-img").attr('cnhfileid', res.msg);
                        $("#cnh-finish-input").attr('fileid', res.msg);
                        $("#cnh-status-img").attr('src',"${re.contextPath}/plugin/common/images/16@2x.png");
                        cnhFileId = res.msg;
                        if(uploadFilePara.type == '552' && res.josnObj){
                            var fileSuffix = res.josnObj.suffix;
                            if(fileSuffix){
                                $('#cnh-span').attr('filesuffix',fileSuffix);
                            }
                            var fileUrl = res.josnObj.fileurl;
                            if(fileUrl){
                                $('#cnh-span').attr('fileurl',fileUrl);
                            }
                        }
                    } else {
                        layer.msg("上传失败！" + res.msg, {icon: 2});
                    }
                    delete this.files[index];
                },
                error: function (index, upload) {
                    layer.msg("上传失败！");
                }
            });

            table.render({
                elem: '#yjtable',
                data: [],
                page: false,
                limit: Number.MAX_VALUE,
                cols: [[
                    {field: 'supId', hide: true},
                    {field: 'tableInd', hide: true},
                    {field: 'supName', title: '项目名称', align: 'center', edit: 'text'},
                    {field: 'supArea', title: '所属行业', align: 'center',  templet: '#tabelArea'},
                    {field: 'constructionUnit', title: '建设单位', align: 'center', edit: 'text'},
                    {field: 'supTzMoney', title: '项目投资金额(万)', align: 'center', edit: 'text'},
                    {field: 'supHtMoney', title: '服务合同金额(万)', align: 'center', edit: 'text'},
                    {field: 'supRemark', title: '备注', align: 'center', edit: 'text'},
                    {templet: setYjImg, title: '上传图片', align: 'center', width: '12%' },
                    {field: 'action', title: '操作', align: 'center', toolbar: '#barDemoYj'}
                ]],
                text: {
                    none: '点击下方添加按钮添加业绩' //默认：无数据。注：该属性为 layui 2.2.5 开始新增
                },
                done: function (res, currentCount,count) {
                    //***重点***：table渲染完成后渲染element进度条
                    var yjImgUploadSpans = $(".yj-img-uplod-span");
                    if(yjImgUploadSpans && yjImgUploadSpans.length > 0){
                        setYjImgUploader(table,yjImgUploadSpans,0);
                    }

                    //设置下拉框样式在表格之上 不会遮挡下拉框
                    $(".layui-table-body").css('overflow','visible');
                    $(".layui-table-box").css('overflow','visible');
                    $(".layui-table-view").css('overflow','visible');

                    var tableElem = this.elem.next('.layui-table-view');
                    count || tableElem.find('.layui-table-header').css('overflow', 'auto');
                    layui.each(tableElem.find('select[name="supArea"]'), function (index, item) {
                        var elem = $(item);
                        elem.val(elem.data('state')).parents('div.layui-table-cell').css('overflow', 'visible');
                        elem.val(elem.data('state')).parents('div.layui-table-cell').css('height', '100%');
                        elem.val(elem.data('state')).parents('div.layui-table-cell').css('padding', '0px');
                        elem.val(elem.data('state')).parents('td').css("padding","0px");
                        // elem.val("交警");
                        // form.render(item);
                        elem.next().find('input').val(table.cache['yjtable'][index].supAreaName);
                        elem.next().find('dd').removeClass('layui-this');
                        elem.next().find('dd[lay-value="'+table.cache['yjtable'][index].supArea+'"]').click();
                    });
                    //刷新表单

                }
            })

            table.on('edit(yjtable)',function(obj){
                //获取该单元格原来的值,oldtext就是原来的值
                var selector = obj.tr.find('[data-field=' + obj.field + ']');
                var oldtext = $(selector).text();
                //ooo代表需要校验的列field
                if (obj.field == 'supName' || obj.field == 'constructionUnit'
                    || obj.field == 'supTzMoney' || obj.field == 'supHtMoney'|| obj.field == 'supRemark') {
                    if(obj.value && obj.value.length > 30){
                        layer.msg("长度不得超过30", {icon: 2});
                        obj.tr.find('td[data-field='+obj.field+'] input').val(oldtext);
                        obj.update({ ooo: oldtext });
                    }
                }

                if (obj.field == 'supTzMoney' || obj.field == 'supHtMoney') {
                    if(!(/^(?!0+(?:\.0+)?$)(?:[1-9]\d*|0)(?:\.\d{1,2})?$/.test(obj.value))){
                        layer.msg("请输入正确的金额", {icon: 2});
                        obj.tr.find('td[data-field='+obj.field+'] input').val(oldtext);
                        obj.update({ ooo: oldtext });
                    }
                }
            })

            form.on('select(hyselect)', function (data) {
                var id = data.elem.dataset.value;
                var tableind = data.elem.dataset.tableind;
                var supAreaCode = data.elem.value;
                // data.elem.value = id;
                if(tableind && supAreaCode){
                    table.cache['yjtable'][tableind].supArea = supAreaCode;
                }
                //修改状态
                //....这里省略一个ajax请求...
                // 传值：表单变化后的值传递到后台数据库进行实时修改，例如，根据id修改这条数据的状态。
            });


        });

        // $("input").blur(function(){
        //     if($(this).val().length > 50){
        //         var newVal = $(this).val().substr(0,50);
        //         $($(this).val(newVal));
        //         layer.msg("输入长度不能大于50", {icon: 5, anim: 6, offset: 'c'});
        //     }
        // })


        setTimeout(function(){
            flushZzTable();
            flushYjTable();
        },1000);
    });
    var jsondata = {
        type: '101'
    }
    var _imgid = 'img';
    layui.use('upload', function () {
        var upload = layui.upload;
        //执行实例
        upload.render({
            elem: '.gr_upload',//绑定元素
            url: '/sys/personCenter/uploadFile',//上传接口
            acceptMime: 'image/*',
            data: jsondata,
            before: function (obj) {
                var files = this.files = obj.pushFile();
                jsondata.type = this.type;
                _imgid = this.imgid;
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                    $('#' + _imgid).attr('src', '');
                    $('#' + _imgid).show();
                    $('#del' + _imgid).show();
                    $('#' + _imgid).attr('src', result); //图片链接（base64）
                    if ('208' == jsondata.type) {
                        parent.changeLogo(result);
                    }
                });
            },
            done: function (res, index) {
                if (res.flag == true) {
                    $('#' + _imgid).show().attr('src', res.data + '?v=' + Math.random());
                    if (res.josnObj) {
                        var json = res.josnObj.words_result;
                        if(json){
                            var ToStr = JSON.stringify(json);
                            if ($('#jgcode').val() != JSON.stringify(ToStr).substr(26, 18)) {
                                console.log("解析的营业执照:");
                                console.log(JSON.stringify(ToStr).substr(26, 18));
                                //提示营业执照不匹配,请重新上传
                                layer.msg("营业执照不匹配!", {icon: 2});
                                delete this.files[index];
                                //删除营业执照:

                                // $('#' + _imgid).show().attr('src','');
                                // $('#' + _imgid).hide();
                                return;
                            }
                        }
                        // $('#jgcode').val(JSON.stringify(ToStr).substr(26,18));
                    }
                    layer.msg("上传成功",{icon:1});
                } else {
                    layer.msg('上传失败' + res.msg);
                }
                delete this.files[index];
            },
            error: function () {
                //请求异常回调
                var demoText = $('#demoText');
                layer.msg('上传失败');
            }
        });
    })

    // 电话校验
    String.prototype.Trim = function () {
        var m = this.match(/^\s*(\S+(\s+\S+)*)\s*$/);
        return (m == null) ? "" : m[1];
    };
    String.prototype.isMobile = function () {
        return (/^1[3|4|5|7|8|9][0-9]\d{4,8}$/.test(this.Trim()));
    };
    String.prototype.isTel = function () {
        //"兼容格式: 国家代码(2到3位)-区号(2到3位)-电话号码(7到8位)-分机号(3位)"
        //return (/^(([0\+]\d{2,3}-)?(0\d{2,3})-)?(\d{7,8})(-(\d{3,}))?$/.test(this.Trim()));
        return (/^(([0\+]\d{2,3}-)?(0\d{2,3})-)(\d{7,8})(-(\d{3,}))?$/.test(this.Trim()));
    };
    /*--------------------选择省获取市-----------------------------------------*/
    form.on('select(province)', function (data) {
        var code = data.value;
        if (code == "") {
            return;
        }
        $.ajax({
            cache: true,
            type: "get",
            url: "getCity",
            data: {"code": code},
            success: function (data) {
                $("#city").empty();
                /*    $("#city").append("<option value=''>选择市</option>");*/
                for (var i = 0; i < data.length; i++) {
                    $("#city").append("<option value='" + data[i].code + "'>" + data[i].name + "</option>");
                }
                layui.form.render("select")
            }, error: function (error) {
                return;
            }
        })
    });

    function getId(){
        return Date.now()+(Math.random()*1000000).toString().substr(0,3);
    }

    function pass(){
        console.log("pass");
        var auditStatus = '1';
        var sendData = {
            id: $("#id").val(),
            auditStatus: '1'
        }
        audit(sendData);
    }

    function noPass(){
        console.log("noPass");
        layer.prompt({title: '拒绝原因', formType: 2}, function(text, index){
            if(text.length > 60){
                layer.msg("超出限制60字",{icon:2});
                return ;
            }
            layer.close(index);
            var sendData = {
                id: $("#id").val(),
                auditStatus: '2',
                auditFailReason: text
            }
            audit(sendData);
        });

    }

    function audit(data){
        $.ajax({
            url: '/sys/personCenter/audit',
            data: data,
            type: 'post',
            dataType: 'json',
            success: function(res){
                if(res.flag){
                    layer.msg('操作成功',{icon:1});
                    closeThisPage();
                }else{
                    layer.msg(res.msg,{icon:2})
                }
            }
        });
    }

    function closeThisPage(){
        //关闭当前页面
        setTimeout(function(){
            var index = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index);
        },1000);
    }


    //下载承诺函
    function down_cnh() {
        var _href = encodeURI('/download/doc?fileName=承诺函.doc');
        location.href = _href;
    }

    function uploadCnh(e) {
        $(e).next().click();
    }

    function finishcnh(e) {
        var fileId = cnhFileId;
        if (cnhFileStatus == '2') {
            layer.msg("已完成", {icon: 2});
            return;
        }
        if (!cnhFileId) {
            layer.msg("请先上传文件!", {icon: 2});
            return;
        }

        $.ajax({
            url: '/sys/personCenter/updatecnh',
            data: {id: fileId},
            type: 'post',
            dataType: 'json',
            success: function (res) {
                if (res.flag) {
                    layer.msg("操作成功", {icon: 1});
                    $("#upload-cnh-img").prop("onclick", null);
                    $("#del-cnh-img").prop("onclick", null);
                    $("#upload-cnh-img").removeClass("cursor");
                    $("#del-cnh-img").removeClass("cursor");
                    $("#upload-cnh-img").css("cursor", "not-allowed");
                    $("#del-cnh-img").css("cursor", "not-allowed");
                    $("#cnh-file-ul").show();
                    $("#cnh-finish-input").prop("onclick", null);
                    $("#cnh-finish-input").css("cursor", "not-allowed");
                    $("#cnh-status-img").attr('src',"${re.contextPath}/plugin/common/images/15@2x.png");
                    cnhFileStatus = "2";
                } else {
                    layer.msg(res.msg, {icon: 2});
                }
            }
        })
    }

    function delCnh(e) {
        if (!cnhFileId) {
            layer.msg('没有需要删除的文件', {icon: 2});
            return;
        }
        var fileChecked = $("#cnh-checkbox").prop('checked');
        if (!fileChecked) {
            layer.msg('请先选中文件', {icon: 2});
            return;
        }
        layer.confirm('确认删除吗?', function () {
            $.ajax({
                url: '/sys/personCenter/delcnh',
                data: {id: cnhFileId},
                type: 'post',
                dataType: 'json',
                success: function (res) {
                    if (res.flag) {
                        layer.msg('操作成功', {icon: 1});
                        $("#cnh-checkbox").prop('checked', false);
                        $("#cnh-file-ul").hide();
                        cnhFileId = "";
                        cnhFileStatus = "";
                        $("#cnh-status-img").attr('src',"${re.contextPath}/plugin/common/images/17@2x.png");
                        return;
                    }
                    layer.msg(res.msg, {icon: 2});
                }
            })
        })
    }

    function seeEnvDetail(e) {
        var spId = $(e).attr('spid');
        var w = "";
        var h = "";
        if (w == null || w == '') {
            w = ($(window).width()*0.9);
        };
        if (h == null || h == '') {
            h = ($(window).height()*0.9);
        }
        parent.layer.open({
            type: 2,
            area: [w + 'px', h + 'px'],
            title: false,
            closeBtn: 0, //不显示关闭按钮
            shade: 0.8,
            content: '/supervisor/projectManager/evaluationResult?spId=' + spId, //iframe的url，no代表不显示滚动条
        });
    }
    function addOneEmptyLine(laytable){
        var oldData = table.cache[laytable];
        var data1 = {

        };
        oldData.push(data1);
        table.reload(laytable, {
            data: oldData
        });
    }
    function getNowDate(){
        var nowDate = new Date();
        var year = nowDate.getFullYear();
        var month = (nowDate.getMonth()*1)+1;
        if(month < 10){
            month = "0"+month;
        }
        var date = nowDate.getDate();
        if(date < 10){
            date = "0"+date;
        }
        return year+"-"+month+"-"+date;
    }

    //表格图片显示
    function setZzImg(data) {
        var tableIndex = data.LAY_TABLE_INDEX;
        if (data.imgUrl) {
            if(data.imgUrl.indexOf('data:') == 0){
                return '<img id="uploadZzImg'+data.LAY_TABLE_INDEX+'" tableind="'+data.LAY_TABLE_INDEX+'" class="cursor" src="'+data.imgUrl+'" style="height:50px" onclick="showImg(this)">'
            }else{
                return '<img id="uploadZzImg'+data.LAY_TABLE_INDEX+'" tableind="'+data.LAY_TABLE_INDEX+'" class="cursor" src="'+data.imgUrl+'" style="height:50px" onclick="showImg(this)">'
            }
        } else {

            return '<span id="uploadZzSpan'+data.LAY_TABLE_INDEX+'" tableind="'+data.LAY_TABLE_INDEX+'" class="cursor zz-img-uplod-span" style="color:lightseagreen">上传图片</span>'
        }
    }
    function setYjImg(data) {
        var tableIndex = data.LAY_TABLE_INDEX;
        if (data.imgUrl) {
            if(data.imgUrl.indexOf('data:') == 0){
                return '<img id="uploadYjImg'+data.LAY_TABLE_INDEX+'" tableind="'+data.LAY_TABLE_INDEX+'" class="cursor" src="'+data.imgUrl+'" style="height:50px" onclick="showImg(this)">'
            }else{
                return '<img id="uploadYjImg'+data.LAY_TABLE_INDEX+'" tableind="'+data.LAY_TABLE_INDEX+'" class="cursor" src="'+data.imgUrl+'" style="height:50px" onclick="showImg(this)">'
            }
        } else {
            return '<span id="uploadYjSpan'+data.LAY_TABLE_INDEX+'" tableind="'+data.LAY_TABLE_INDEX+'" class="cursor yj-img-uplod-span" style="color:lightseagreen">上传图片</span>'
        }
    }



    //保存资质证明表格数据
    function saveCertificate(e){
        var cacheElement = table.cache['zztable'];
        if(cacheElement.length==0){
            layer.msg("没有需要保存的资质证明",{icon:2});
            return ;
        }
        var sendData = [];
        var emptyCount = 0;
        for(var a=0;a<cacheElement.length;a++){
            var aRow = {};
            var aTableRow = cacheElement[a];
            aRow.tableInd = aTableRow.LAY_TABLE_INDEX;
            if(aTableRow.sucId){
                aRow.sucId = aTableRow.sucId;
            }else{
                emptyCount++;
            }
            if(aTableRow.getDate){
                aRow.getDate = aTableRow.getDate;
            }else{
                emptyCount++;
            }
            if(aTableRow.issuingOrg){
                aRow.issuingOrg = aTableRow.issuingOrg;
            }else{
                aRow.issuingOrg = '';
                emptyCount++;
            }
            if(aTableRow.valiDate){
                aRow.valiDate = aTableRow.valiDate;
            }else{
                emptyCount++;
            }
            if(aTableRow.certificateName){
                aRow.certificateName = aTableRow.certificateName;
            }else{
                aRow.certificateName = '';
                emptyCount++;
            }
            if(emptyCount > 4){
                layer.msg("有未完成的资质证明",{icon:2});
                return false;
            }
            sendData.push(aRow);
            emptyCount = 0;
        }
        if(emptyCount > 4){
            return ;
        }
        $.ajax({
            url: '/sys/personCenter/addCertList',
            data: JSON.stringify(sendData),
            contentType:"application/json;",
            type: 'post',
            dataType: 'json',
            success: function(res){
                if(res.flag){
                    layer.msg("保存成功",{icon:1});
                    flushZzTable();
                    flushAuditStatus();
                }
            }
        })
    }

    function saveYj(e){
        var cacheElement = table.cache['yjtable'];
        if(cacheElement.length==0){
            layer.msg("没有需要保存的业绩",{icon:2});
            return ;
        }
        var sendData = [];
        var emptyCount = 0;
        for(var a=0;a<cacheElement.length;a++){
            var aRow = {};
            var aTableRow = cacheElement[a];
            aRow.tableInd = aTableRow.LAY_TABLE_INDEX;
            if(aTableRow.supId){
                aRow.supId = aTableRow.supId;
            }else{
                emptyCount++;
            }
            if(aTableRow.supName){
                aRow.supName = aTableRow.supName;
            }else{
                emptyCount++;
                aRow.supName = '';
            }
            if(aTableRow.supArea){
                aRow.supArea = aTableRow.supArea;
            }else{
                emptyCount++;
                aRow.supArea = '';
            }
            if(aTableRow.constructionUnit){
                aRow.constructionUnit = aTableRow.constructionUnit;
            }else{
                emptyCount++;
                aRow.constructionUnit = '';
            }
            if(aTableRow.supTzMoney){
                aRow.supTzMoney = aTableRow.supTzMoney;
            }else{
                emptyCount++;
                aRow.supTzMoney = '';
            }
            if(aTableRow.supHtMoney){
                aRow.supHtMoney = aTableRow.supHtMoney;
            }else{
                emptyCount++;
                aRow.supHtMoney = '';
            }
            if(aTableRow.supRemark){
                aRow.supRemark = aTableRow.supRemark;
            }else{
                emptyCount++;
                aRow.supRemark = '';
            }
            if(emptyCount > 6){
                layer.msg("有未完成的业绩",{icon:2});
                return false;
            }
            sendData.push(aRow);
            emptyCount = 0;
        }
        if(emptyCount > 6){
            return ;
        }
        $.ajax({
            url: '/sys/personCenter/addProjectList',
            data: JSON.stringify(sendData),
            contentType:"application/json;",
            type: 'post',
            dataType: 'json',
            success: function(res){
                if(res.flag){
                    layer.msg("保存成功",{icon:1});
                    flushYjTable();
                }
            }
        })
    }


    function flushZzTable(){
        //从数据库中获取数据:
        //带着data调用reload方法:
        var url = '/sys/personCenter/selectCertList';
        if(shenhe){
            url = url + '?userId='+shenheinguserid;
        }
        $.ajax({
            url: url,
            data: '',
            type: 'get',
            cache: false,
            dataType: 'json',
            success: function(res){
                if(res.flag){
                    table.reload('zztable',{data:res.data})
                }else{
                    layer.msg(res.msg,{icon:2});
                }
            },
            error: function(res){
                layer.msg("系统出错!",{icon:2});
            }
        })
    }

    function flushYjTable(){
        var url = '/sys/personCenter/selectYjList';
        if(shenhe){
            url = url + '?userId='+shenheinguserid;
        }
        //从数据库中获取数据:
        //带着data调用reload方法:
        $.ajax({
            url: url,
            data: '',
            type: 'get',
            cache: false,
            dataType: 'json',
            success: function(res){
                if(res.flag){
                    table.reload('yjtable',{data:res.data})
                }else{
                    layer.msg(res.msg,{icon:2});
                }
            },
            error: function(res){
                layer.msg("系统出错!",{icon:2});
            }
        })
    }

    function setZzImgUploader(table,spans,i){
        var aSpan = spans[i];
        var thisTableInd = $(aSpan).attr('tableind');
        var sucId = '';
        if(table.cache && table.cache['zztable'] && table.cache['zztable'][thisTableInd]){
            var tableSucId = table.cache['zztable'][thisTableInd].sucId;
            if(tableSucId && tableSucId != 'undefined'){
                sucId = tableSucId;
            }
        }
        upload.render({
            elem: '#uploadZzSpan'+thisTableInd, //绑定元素
            url: '/sys/personCenter/uploadFile', //上传接口
            data:{
                type: '551',
                ids: sucId
            },
            acceptMime: 'image/*',
            before: function (obj) {
                var files = this.files = obj.pushFile();
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                    // $('#'+_imgid).attr('src', result); //图片链接（base64）
                    table.cache['zztable'][thisTableInd]['imgUrl'] = result;
                });
            },
            done: function(res,index){
                //上传完毕回调
                if (res.flag ==true) {
                    if(res.josnObj){
                        var sucId = res.josnObj.certId;
                        if(sucId){
                            //设置本行的certId:
                            table.cache['zztable'][thisTableInd]['sucId'] = sucId;
                            table.reload('zztable');
                        }
                    }
                    table.cache['zztable'][thisTableInd]['imgUrl'] = res.data+'?v='+Math.random();
                    $('#'+_imgid).show().attr('src', res.data+'?v='+Math.random());
                    table.reload('zztable');
                    layer.msg("上传成功",{icon:1});
                }else{
                    layer.msg('上传失败'+res.msg,{icon:2});
                }
                delete this.files[index];
            },
            error: function(){
                //请求异常回调

                layer.msg('上传失败');
            }
        });
        i++;
        if(i < spans.length){
            setZzImgUploader(table,spans,i);
        }
    }

    function setYjImgUploader(table,spans,i){
        var aSpan = spans[i];
        var thisTableInd = $(aSpan).attr('tableind');
        var supId = '';
        if(table.cache && table.cache['yjtable'] && table.cache['yjtable'][thisTableInd]){
            var tableSupId = table.cache['yjtable'][thisTableInd].supId;
            if(tableSupId && tableSupId != 'undefined'){
                supId = tableSupId;
            }
        }
        upload.render({
            elem: '#uploadYjSpan'+thisTableInd, //绑定元素
            url: '/sys/personCenter/uploadFile', //上传接口
            data:{
                type: '553',
                ids: supId
            },
            acceptMime: 'image/*',
            before: function (obj) {
                var files = this.files = obj.pushFile();
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                    // $('#'+_imgid).attr('src', result); //图片链接（base64）
                    table.cache['yjtable'][thisTableInd]['imgUrl'] = result;
                });
            },
            done: function(res,index){
                //上传完毕回调
                if (res.flag ==true) {
                    if(res.josnObj){
                        var supId = res.josnObj.certId;
                        if(supId){
                            //设置本行的certId:
                            table.cache['yjtable'][thisTableInd]['supId'] = supId;
                            table.reload('yjtable');
                        }
                    }
                    $('#'+_imgid).show().attr('src', res.data+'?v='+Math.random());
                    table.cache['yjtable'][thisTableInd]['imgUrl'] = res.data+'?v='+Math.random();
                    table.reload('yjtable');
                    layer.msg("上传成功",{icon:1});
                }else{
                    layer.msg('上传失败'+res.msg,{icon:2});
                }
                delete this.files[index];
            },
            error: function(){
                //请求异常回调
                layer.msg('上传失败');
            }
        });
        i++;
        if(i < spans.length){
            setYjImgUploader(table,spans,i);
        }
    }

    function delZz(e){
        layer.confirm('确定删除?', function(index){
            var sucId = $(e).attr('sucId');
            var tableInd = $(e).attr('tableind');
            if(sucId && sucId != 'undefined'){
                $.ajax({
                    url: '/sys/personCenter/delCert',
                    data: {
                        sucId: sucId
                    },
                    type: 'post',
                    dataType: 'json',
                    success: function(res){
                        if(res.flag){
                            layer.msg("操作成功",{icon:1});
                            table.cache['zztable'].splice(tableInd,1);
                            table.reload('zztable',{
                                data: table.cache['zztable']
                            });
                        }
                    }
                })
            }else{
                table.cache['zztable'].splice(tableInd,1);
                table.reload('zztable',{
                    data: table.cache['zztable']
                });
            }
            layer.close(index);
            //向服务端发送删除指令
        });
    }

    function checkPhoto(mark,name){

        if(!($("."+mark+"_img").attr("src"))){
            $("html, body").animate({ scrollTop: $("#"+mark+"_div").offset().top-100 }, 500)
            $("#"+mark+"_div").css('border','1px dashed red');
            setTimeout(function(){
                $("#"+mark+"_div").css('border','1px dashed #3D6AFF');
            },2000);
            layer.msg("请上传"+name+"照片", {icon: 2});
            return false;
        };
        return true;
    }

    function flushAuditStatus(){
        $.ajax({
            url: '/sys/personCenter/getAuditStatus',
            data: {id: $("#id").val()},
            type: 'get',
            cache: false,
            dataType: 'json',
            success: function(res){
                if(res && res.flag){
                    var newAuditStatus = res.data;
                    if(newAuditStatus){
                        $(".audit-status:not(.audit-status"+newAuditStatus+")").attr('hidden','true');
                        $(".audit-status"+newAuditStatus).show();
                        if(newAuditStatus == '2'){
                            $(".audit-status"+newAuditStatus).html('信息审核未通过，驳回原因：'+res.msg);
                        }
                    }
                }else{
                    layer.msg(res.msg,{icon:2});
                }
            }
        })
    }

    function openCnh(e){
        var fileSuffix = $(e).attr('filesuffix');
        var fileUrl = $(e).attr('fileurl');
        console.log(fileSuffix);
        console.log(fileUrl);
        var h = ($(window).height() *0.9);
        if(fileSuffix){
            var w = "";
            var h = "";
            if (w == null || w == '') {
                w = ($(window).width()) * 0.8;
            }
            if (h == null || h == '') {
                h = ($(window).height()) * 0.8;
            }
            if(['pdf'].indexOf(fileSuffix.toLowerCase()) !== -1){
                var fileId = $(e).parents('ul').attr('cnhid');
                console.log(fileId);
                layer.open({
                    type: 2,
                    title: '承诺函',
                    shadeClose: true,
                    area: [w + 'px', h + 'px'],
                    maxmin: true,
                    content: '${re.contextPath}/pdf/open?fileId='+fileId,
                });

            }else if(ifImg(fileSuffix)){
                var imgUrl=fileUrl+"?v="+Math.random();
                getImageWidth(imgUrl,function(imgW,imgH){
                    if(imgW*1 > w*1){
                        imgW = w*1;
                    }
                    if(imgH*1 > h*1){
                        imgH = h*1;
                    }
                    layer.open({
                        type: 1,
                        title: false,
                        closeBtn: 0,
                        area: [imgW+"px",imgH+"px"],
                        skin: 'layui-layer-nobg', //没有背景色
                        shadeClose: true,
                        content: '<img src="'+imgUrl+'" height="'+imgH+'px" width="'+imgW+'px" />'
                    });
                })

            }else{
                layer.msg('文件未上传或格式不正确!',{icon:2});
            }
        }
    }



    function ifImg(suffix){
        return ['png', 'jpg', 'jpeg', 'bmp', 'gif', 'webp', 'psd', 'svg', 'tiff'].indexOf(suffix.toLowerCase()) !== -1;
    }

    function del(e){
        layer.confirm('确定删除?', function(index){
            var supId = $(e).attr('supId');
            var tableInd = $(e).attr('tableind');
            var tableid = $(e).attr('tableid');
            var delUrl = $(e).attr('delurl');
            if(supId && supId != 'undefined'){
                $.ajax({
                    url: delUrl,
                    data: {
                        supId: supId
                    },
                    type: 'post',
                    dataType: 'json',
                    success: function(res){
                        if(res.flag){
                            layer.msg("操作成功",{icon:1});
                            table.cache[tableid].splice(tableInd,1);
                            table.reload(tableid,{
                                data: table.cache[tableid]
                            });
                        }
                    }
                })
            } else {
                table.cache[tableid].splice(tableInd, 1);
                table.reload(tableid, {
                    data: table.cache[tableid]
                });
            }
            layer.close(index);
            //向服务端发送删除指令
        });
    }

    function deleteImg(e, i, j) {
        var imgid = $(j).attr('data-id')
        var imgtype = $(j).attr('data-type')
        parent.layer.confirm('确定删除？', function (index) {
            $.ajax({
                url: '/sys/personCenter/delUserImage',
                data: {type: imgtype},
                type: 'post',
                cache: false,
                dataType: 'json',
                success: function (res) {
                    if (res && res.flag) {
                        layer.msg(res.msg, {icon: 1});
                        $('#' + imgid).removeAttr('src')
                        $(j).hide();
                        parent.layer.close(index);
                    } else {
                        layer.msg(res.msg, {icon: 2});
                    }
                }
            })
        });


    }
</script>
</body>

</html>
